#pragma once
#include "item-cache.h"
#include "obj.h"
#include <unordered_map>

struct Item {
  bool is_bound();
  std::string get_subtype_name();
  std::string get_type_name();
  std::string subtype_name();
  uint32 subtype_index();
  std::string type_name();
  uint32 type_index();
  std::string name();
  uint32 num();
  uint32 rarity();
  uint32 level();
  uint32 min_level();
  uint32 price();
  uint32 item_id();
  uintptr ptr();
  ObjType type();
  uint32 index();
  uint64 id1();
  uint64 id2();
  // --- Constructors ---
  Item(uint64 base, uint64 ptr, std::shared_ptr<ItemCache> item_cache);
  Item() = delete;
  Item(Item &&) = default;
  Item(const Item &) = default;
  Item &operator=(Item &&) = default;
  Item &operator=(const Item &) = default;
  ~Item();

private:
  uint64 get_item_prop();

private:
  static std::unordered_map<uint32, uint64> item_prop_map_;

private:
  std::shared_ptr<ItemCache> cache_;
  uint64 base_;
  Obj obj_;
  uint32 item_id_;
  uint32 num_;
  uint8 is_bound_;
  std::string name_;
  uint32 rarity_;
  uint32 level_;
  uint32 min_level_;
  uint32 price_;
  uint32 type_index_;
  std::string type_;
  uint32 subtype_index_;
  std::string subtype_;
};
